package com.yq.admin01.dao;

import com.yq.admin01.emtity.Emp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class EmpDaoImpl implements EmpDao {

    @Autowired
    JdbcTemplate jdbcTemplate;

    @Override
    public List<Emp> findAll() {
        return jdbcTemplate.query("select id,name,age,sex,phone,salary,did from t_emp", new BeanPropertyRowMapper<>(Emp.class));
    }
}
